<?php
/**
 * @author tungck
 * @filesource chamcong_model.php
 * file model for process position manager
*/
?>

<?php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class chamcong_model extends CI_Model{
    
    public $tableName = 'chamcong';
    
    function __construct(){
        parent::__construct();
        $this->load->helper('url');
        $this->load->database();
        
    }
    
    // lay danh sách vi tri chuc danh
    function getList($data){
        $recordCount = $this->db->count_all_results('chamcong');
        if(isset($data['filter'])){
            $query = $this->db->query("SELECT * FROM chamcong WHERE NgayLam = '".$data['filter']."' AND MaHoSo=".$data['MaHoSo']." ORDER BY " . $data['sort'] . " LIMIT " . $data['startIndex'] . "," . $data['pageSize'] . ";");
        }else{
            $query = $this->db->query("SELECT * FROM chamcong WHERE MaHoSo=".$data['MaHoSo']." ORDER BY " . $data['sort'] . " LIMIT " . $data['startIndex'] . "," . $data['pageSize'] . ";");
        }
        
        if($query){
            $result['query'] = $query->result();
            $result['recordCount'] = count($query->result());
            return $result;
        }else{
            return false;
        }
        
    }
    
    
    
}

?>